function Generate(min = 1, max = 10, step = 1) {
    this.min = min
    this.max = max
    this.step = step
    this.current = this.min
}
Generate.prototype.echo = function () {
    var out = this.current
    if ((this.current + this.step) <= this.max) {
        this.current += this.step
    } else {
        this.current = this.min
    }
    return out
}
Generate.prototype.reset = function () {
    this.current = this.min
}

var g1 = new Generate()

const Generate  = (min = 1, max = 10, step = 1) => {
    let current = min
    let echo = () => {
        let output = current
        if ((current + step) <= max) {
            current += step
        } else {
            current = min
        }
        return output        
    }
    echo.reset = () => {
        current = min
        return echo()
    }
    return echo
}
var g1 = Generate()